package ca.jerg.config;

public class ErgConfigWork extends ErgConfig
{
	/*
	 * Default work intensities.  Apply constant to
	 * threshold wattage to determine the resulting
	 * work load.
	 */
	public static final double DEF_ANAEROBIC_LOAD = 1.35;
	public static final double DEF_VO2_LOAD = 1.20;
	public static final double DEF_FT_LOAD = 1.05;
	public static final double DEF_TEMPO_LOAD = 0.90;
	public static final double DEF_DISTANCE_LOAD = 0.75;
	public static final double DEF_REST_LOAD = 0.5;

	public static void main( String[] args )
	{
		ErgConfigWork ecw = new ErgConfigWork();
		
		ecw.defaults();
		//ecw.exportConfig("c:\\test.xml");
		//ecw.importConfig("c:\\test.xml");
	}
	
	private final String ERG_CFG_WORK_STR = "ErgCfgWork: ";	
	
	public ErgConfigWork()
	{
		super("WorkLoads");
		
		double d;
		
		/*
		 * The first time this class is loaded there is no
		 * stored Work Load configuration.  If, that is
		 * the case then create a setup using the default
		 * values.
		 */
		d = config.getDouble(KEY_ANAEROBIC,-1.0);
		if ( d == -1.0 )
			config.putDouble(KEY_ANAEROBIC,DEF_ANAEROBIC_LOAD);

		d = config.getDouble(KEY_VO2,-1.0);
		if ( d == -1.0 )
			config.putDouble(KEY_VO2,DEF_VO2_LOAD);

		d = config.getDouble(KEY_FT,-1.0);
		if ( d == -1.0 )
			config.putDouble(KEY_FT,DEF_FT_LOAD);

		d = config.getDouble(KEY_TEMPO,-1.0);
		if ( d == -1.0 )
			config.putDouble(KEY_TEMPO,DEF_TEMPO_LOAD);
		
		d = config.getDouble(KEY_DISTANCE,-1.0);
		if ( d == -1.0 )
			config.putDouble(KEY_DISTANCE,DEF_DISTANCE_LOAD);
		
		d = config.getDouble(KEY_REST,-1.0);
		if ( d == -1.0 )
			config.putDouble(KEY_REST,DEF_REST_LOAD);			
	}
	
	public void defaults()
	{
		config.putDouble(KEY_ANAEROBIC,DEF_ANAEROBIC_LOAD);
		config.putDouble(KEY_VO2,DEF_VO2_LOAD);
		config.putDouble(KEY_FT,DEF_FT_LOAD);
		config.putDouble(KEY_TEMPO,DEF_TEMPO_LOAD);
		config.putDouble(KEY_DISTANCE,DEF_DISTANCE_LOAD);
		config.putDouble(KEY_REST,DEF_REST_LOAD);
	}
	
	public boolean getBoolean( String key, boolean def )
	{
		// no boolean values
		return false;
	}

	
	public double getDouble( String key, double def )
	{
		return config.getDouble(key,def);
	}

	
	public int getInt( String key, int def )
	{
		// no int values
		return 0;
	}

	
	public String getString( String key, String def )
	{
		// no string values
		return null;
	}

	
	public void put( String key, String value )
	{
		// no string values
	}
	
	
	public void putBoolean( String key, boolean value )
	{
		// no boolean values
	}
	
	
	public void putDouble( String key, double value )
	{
		config.putDouble(key,value);
	}
	
	
	public void putInt( String key, int value )
	{
		// no int values
	}	
}
